<?php

session_start();



function create_image() {

	$md5_hash = md5(rand(0,999));

	$security_code = substr($md5_hash, 10, 5);

	$_SESSION['security_code'] = $security_code;

	

	//image

	$width = 70;

	$height = 24;

	$image = imagecreate($width, $height);

	$white = imagecolorallocate($image, 255, 255, 255);

	$blue = imagecolorallocate($image, 47, 91, 180);

	imagefill($image, 0, 0, $blue);

	imagestring($image, 12, 15, 4, $security_code, $white);

	

	//create

	header("Content-Type: image/jpeg");

	imagejpeg($image);

	imagedestroy($image);

}

create_image();

exit();

?>